package com.cr.web.controller.api;

import com.cr.common.core.domain.AjaxResult;
import com.cr.system.service.ISysDictTypeService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;

@RestController
@RequestMapping("api/dict")
@Validated
public class DictController {

    @Resource
    private ISysDictTypeService dictTypeService;

    /**
     * 获取字典数据
     */
    @GetMapping("data")
    public AjaxResult getDictData(@NotBlank(message = "字典类型不能为空！") String type){
        return AjaxResult.success(dictTypeService.appSelectDictDataByType(type));
    }

}
